package com.midou.administration.controller;


import com.midou.administration.entity.DeskType;
import com.midou.administration.service.DeskTypeService;
import com.midou.administration.service.impl.DeskTypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author MrChen
 * @since 2021-03-24
 */
@RestController
@RequestMapping("/administration/desk-type")
public class DeskTypeController {
    @Resource
    private DeskTypeService deskTypeService;

    @Autowired
    private DeskTypeServiceImpl desktype;
    @RequestMapping("/query-desk-type")
    public List<DeskType> queryDeskType(@RequestBody Integer id){
        System.out.println(deskTypeService.queryDeskType(id));
        return deskTypeService.queryDeskType(id);
    }

    @RequestMapping("/queryAll")
    public List<DeskType> queryAll(){
        List<DeskType> list=desktype.queryAll();
        return desktype.queryAll();
    }

    @RequestMapping("/queryAdd")
    public int  queryAdd(@RequestBody DeskType deskTypes){
        int a=desktype.queryAdd(deskTypes);
        if (a>0){
            return desktype.queryAdd(deskTypes);
        }else {
            return 0;
        }
    }

    @RequestMapping("/queryAllByBusiness")
    public List<DeskType> queryAllByBusiness(int id){
        return this.deskTypeService.queryAllByBusiness(id);
    }
}
